import 'package:get/get_connect/http/src/request/request.dart';

class AlarmListResultModel {
  late int code;
  late String message;
  late Content content;

  AlarmListResultModel(
      {required this.code, required this.message, required this.content});

  AlarmListResultModel.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    message = json['message'];
    content = (json['content'] != null
        ? new Content.fromJson(json['content'])
        : null)!;
  }
}

class Content {
  late int total;
  late int page;
  late int perPage;
  late List<AlarmItemModel> data;

  Content(
      {required this.total,
      required this.page,
      required this.perPage,
      required this.data});

  Content.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    page = json['page'];
    perPage = json['per_page'];
    if (json['data'] != null) {
      data = <AlarmItemModel>[];
      json['data'].forEach((v) {
        data.add(new AlarmItemModel.fromJson(v));
      });
    }
  }
}

class AlarmItemModel {
  ///报警id
  late int id;

  ///采集终端号
  late String alarmAddress;

  ///报警事件
  late String alarmEvent;

  ///用户名
  late String userName;

  ///工程id
  late int projectId;

  ///工程名称
  late String projectName;

  ///基表号
  late String tableNum;

  ///报警时间
  late String alarmTime;

  ///水表阀门状态 1开，0关
  late String? isOpen;

  ///经度
  late double longitude;

  ///纬度
  late double latitude;

  AlarmItemModel({
    required this.id,
    required this.userName,
    required this.alarmTime,
    required this.projectId,
    required this.alarmAddress,
    required this.alarmEvent,
    required this.tableNum,
    required this.projectName,
    required this.isOpen,
    required this.longitude,
    required this.latitude,
  });

  AlarmItemModel.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    userName = json['user_name'];
    alarmTime = json['alarm_time'];
    projectId = json['project_id'];
    projectName = json['project_name'];
    alarmAddress = json['alarm_address'];
    alarmEvent = json['alarm_event'];
    tableNum = json['table_num'];
    isOpen = json['is_open'];
    longitude = json['longitude'];
    latitude = json['latitude'];
  }
}
